<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>margin</title>
    <style>
        /* 绝对不用儿子的margin踹父亲,margin是兄弟之间用的,应该用父亲的padding */
        div.box1 {
            width: 100px;
            height: 100px;
            background-color: orange;
            padding-top: 90px;  /*要用父的padding*/
        }

        .box1 .box2 {
            width: 40px;
            height: 40px;
            background-color: blue;
            /*margin-top: 30px;*/  /*绝对不用儿子的margin踹父亲,margin是兄弟之间用的,应该用父亲的padding */
            
        }
    </style>
</head>

<body>

</body>
<div class="box1">
    <div class="box2"></div>
</div>

</html>